﻿Public Class Frm5RolesEditar



    Overloads Sub Show(ByVal p_ID As String, ByVal p_Rol As String, ByVal frm5RolesMenu As Frm5RolesMenu)

        Me.txtRoles.Text = p_Rol
        Me.lblIdRol.Text = p_ID

        Me.Show()
    End Sub

    Private Sub Frm5RolesEditar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    End Sub

    Private Sub BtnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAceptar.Click
        Dim dato As New Roles
        Dim accion As New rolesDAO

        dato.pIdRol = lblIdRol.Text
        dato.pDescrip = txtRoles.Text

        If accion.actualizar(dato) Then
            MessageBox.Show("Registro actualizado", "Modificar", MessageBoxButtons.OK, MessageBoxIcon.Information)

        Else
            MessageBox.Show("No se puede modificar el registro, contacte al administrador", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning)
        End If
        Frm5RolesMenu.Show()
        Me.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Frm5RolesMenu.Show()
        Me.Close()

    End Sub
End Class